package models

import (
	"go-project/common"
)

type Article struct {
	ID            uint              `gorm:"primary_key" json:"id"`
	CreatedAt     *common.LocalTime `json:"created_at"`
	UpdatedAt     *common.LocalTime `json:"updated_at"`
	DeletedAt     *common.LocalTime `sql:"index" json:"deleted_at"`
	Title         string            `gorm:"not null;comment:'文章标题'" json:"title"`
	Status        int8              `gorm:"not null;default:0;comment:'文章状态'" json:"status"`
	Tags          string            `gorm:"type:text;not null;comment:'文章标签'" json:"tags"`
	Content       string            `gorm:"type:text;not null;comment:'文章内容'" json:"content"`
	CategoryId    int               `gorm:"not null;comment:'文章分类id'" json:"category_id"`
	Weight        int8              `gorm:"not null;default:0;comment:'文章权重'" json:"weight"`
	IsRecommend   int8              `gorm:"not null;default:0;comment:'文章状态'" json:"is_recommend"`
	PageView      uint              `gorm:"not null;default:0;comment:'浏览量‘" json:"page_view"`
	NumberOfLikes uint              `gorm:"not null;default:0;comment:'点赞数‘" json:"number_of_likes"`
	//Author        int               `gorm:"not null;comment:'作者‘" json:"author"`
}

func (article *Article) TableName() string {
	return "articles"
}
